import svgwrite

# 29.7 cm width 25 is a safe printable area
# 21.9 cm width 17 is a safe

def makePoly(document, numberOfCircle, radius, yval, horizontal_distance, colorOfFill, colorOfStroke):
    # widthOfPage = float(document.attribs["width"][:-2])
    i = 0
    while i < numberOfCircle:
        positionOnPage = i * horizontal_distance
        x, y = lineBreaker(positionOnPage, yval)
        document.add(document.circle(center=(x, y),r=radius, fill = colorOfFill, stroke = colorOfStroke))
        i = i + 1

# def lineBreaker(x, y):
#     pageWidth = 1587
#     # pageWidth = 1600
#     # pageWidth = 4960
#     while x > pageWidth:
#         # x -= pageWidth
#         x -= 1600
#         # y += 90
#         y += 60
#     return x, y

def lineBreaker(x, y):
    # pageWidth = 1587
    # pageWidth = 1600
    # pageWidth = 4960
    while x > 1587:
        # x -= pageWidth
        x -= 1600
        # y += 90
        y += 60
    return x, y

# svg_document = svgwrite.Drawing(filename = "hyperobject.svg", size = ("841.89px", "595.28px"))
# svg_document = svgwrite.Drawing(filename = "hyperobject.svg", size = ("3508px", "4960px"))

svg_document = svgwrite.Drawing(filename="hyperobject.svg", size=('1587', '1122'))

numberOfLargeCircle = 333
numberOfSmallCircle = 5
horizontal_distance = 80
# horizontal_distance = 70

proportion_horizontal_distance = numberOfLargeCircle / numberOfSmallCircle * horizontal_distance

makePoly(svg_document, numberOfLargeCircle, 5, 100, horizontal_distance, 'red', 'red') # 820 first arg
makePoly(svg_document, numberOfSmallCircle, 5, 80, proportion_horizontal_distance, 'black', 'black')

# makePoly(svg_document, 7, 10, 100, 100, 'red', 'red') # 820 first arg
#
# makePoly(svg_document, 5, 10, 500, proportion_horizontal_distance, 'black', 'black')
# widthOfPage, numberOfCircle, radius, yval

svg_document.save()


